package com.teamclub.erp.scontrollers

import com.teamclub.erp.sforms.ErpGoodsForm
import com.teamclub.erp.sservices.ErpGoodsService
import com.teamclub.util.libs.Eithers
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.{PostMapping, RequestBody, RequestMapping, RestController}

@RestController("com.teamclub.erp.scontrollers.ErpGoodsController")
@RequestMapping(Array("/erp/goods"))
class ErpGoodsController {
  @Autowired
  var erpGoodsService: ErpGoodsService = _

  @PostMapping(Array("list"))
  def list(@RequestBody form: ErpGoodsForm) = {
    Eithers.toJson(erpGoodsService.list(form))
  }
  @PostMapping(Array("add"))
  def add(@RequestBody form: ErpGoodsForm) = {
    Eithers.toJson(erpGoodsService.add(form))
  }
  @PostMapping(Array("del"))
  def del(@RequestBody form: ErpGoodsForm) = {
    Eithers.toJson(erpGoodsService.del(form))
  }
}
